package com.itedge.solutionmanager.web.convert;

import org.springframework.core.convert.converter.Converter;

import com.itedge.solutionmanager.domain.impl.Customer;

/**
 * Converter from Customer to String objects, simply return Customer id as String
 * 
 * @author Jan
 *
 */
public class CustomerToStringConverter implements Converter<Customer, String> {

	@Override
	public String convert(Customer source) {
		if (source == null || source.getId() == null) {
			throw new IllegalArgumentException("Customer object can't be null or without ID!");			
		}
		return source.getId().toString();
	}

}
